<style scoped>
.pageOpt /deep/ .el-form-item {
  margin-bottom: 13px;
}
</style>
<!--  -->
<template>
  <div class="search pageOpt">
    <el-form :inline="true" :model="search" class="demo-form-inline">
      <el-form-item>
        <el-button type="primary" @click="create">创建页面</el-button>
        <el-button type="success" @click="reset">刷新</el-button>
        <el-button type="warning" @click="searchSet">搜索页面设置</el-button>
      </el-form-item>
    </el-form>
    <SavePage ref="createPage" :propsOnSubmit="onSubmit" />
    <SearchConfig ref="searchConfig" />
  </div>
</template>

<script>
// import SavePage from '@/components/main/user/pages/common/SavePage.vue'
import SavePage from '@/components/common/design/dialog/page/editor/SavePage.vue'
import SearchConfig from '@/components/main/user/pages/common/SearchConfig.vue'
export default {
  props: {
    // 改变加载数据的loading属性
    changeDataLoading: {
      type: Function
    },
    // 重置数据
    resetPageData: {
      type: Function
    }
  },
  data () {
    return {
      search: {
        name: ''
      }
    }
  },
  components: {
    SavePage,
    SearchConfig
  },
  methods: {
    onSubmit () {
      // 提交至后台成功后执行
      this.resetPageData()
    },
    create () {
      this.$refs['createPage'].show(null, '新建页面', true)
    },
    reset () {
      this.resetPageData()
    },
    searchSet () {
      this.$refs['searchConfig'].show()
    }
  }
}

</script>
